package com.rd.student.jike.class2.lihongming.Exam;

import java.io.*;
import java.nio.file.Files;
import java.util.Scanner;

/**
 * @Auther:Heinrich
 * @Date:2023/8/8-08-08-15:43
 * @Description:com.rd.student.jike.class2.lihongming.Exam
 * @version:1.0
 */
public class Question1 {
    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        File file = new File("./src/com/rd/student/jike/class2/lihongming/Exam/Student.txt");
        OutputStream outputStream = Files.newOutputStream(file.toPath());
        String s1 = "姓名 语文成绩 数学成绩 总分\n";
        byte[] bytes = s1.getBytes();
        outputStream.write(bytes);
        System.out.println("要输入成绩的人数");
        int ans = s.nextInt();
        for (int i = 0; i < ans; i++) {
            StringBuilder str = new StringBuilder();
            System.out.println("请输入姓名");
            str.append(s.next()).append(" ");
            System.out.println("请输入语文成绩");
            int math = s.nextInt();
            str.append(math).append(" ");
            System.out.println("请输入数学成绩");
            int chinese = s.nextInt();
            str.append(chinese).append(" ");
            str.append(math + chinese).append("\n");
            bytes = str.toString().getBytes();
            outputStream.write(bytes);
        }
        outputStream.close();
    }
}
